<template>
  <div class="shop-header">
    <div class="background">
      <img :src="headerData.avatar" />
    </div>
    <div class="content-wrapper">
      <div class="avatar">
        <img :src="headerData.avatar" />
      </div>
      <div class="shop-info">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{headerData.name}}</span>
        </div>
        <div class="description">
          <div>{{headerData.description}}/{{headerData.deliveryTime}}分钟送达</div>
        </div>
        <div v-if="headerData.supports" class="supports">
          <span class="icon" :class="classMap[headerData.supports[2].type]"></span>
          <span class="text">{{headerData.supports[2].description}}</span>
        </div>
        <div v-if="headerData.supports" class="support-count" @click="deatilShow">
          <span class="count">{{headerData.supports.length}}个</span>
          <i class="icon-keyboard_arrow_right"></i>
        </div>
      </div>
    </div>
    <div class="bulletin-wrapper" @click="deatilShow">
      <span class="bulletin-icon"></span>
      <span class="bulletin-text">{{headerData.bulletin}}</span>
      <i class="icon-keyboard_arrow_right"></i>
    </div>
  </div>
</template>

<script>
export default {
  name: "shopHeader",
  data() {
    return {
      classMap: []
    };
  },
  props: {
    headerData: {
      type: Object,
      default: {}
    }
  },
  methods: {
    deatilShow(){
      this.$Bus.$emit('deatilShow')
    }
  },
  created() {
    this.classMap = ["decrease", "discount", "special", "invoice", "guarantee"];
  }
};
</script>

<style lang="stylus" scoped>
@import '../../common/stylus/mixins.styl'
.shop-header
  position: relative
  overflow: hidden
  color: #fff
  background-color: rgba(7, 17, 27, 0.5)
  .content-wrapper
    display: flex
    position: relative
    box-sizing: border-box
    padding: 20px 0 16px 20px
    height: 106px
    font-size: 0
    color: #fff
    .shop-info
      margin: 2px 0 2px 16px
      .title
        margin-bottom: 8px
      .brand
        display: inline-block
        vertical-align: top
        width: 30px
        height: 18px
        bgimage('./img/brand')
        background-size: 30px 18px
        background-repeat: no-repeat
      .name
        margin-left: 6px
        font-size: 16px
        font-weight: 700
        line-height: 18px
    .description
      font-size: 12px
      line-height: 12px
      margin-bottom: 10px
    .supports
      font-size: 12px
      line-height: 12px
      .icon
        display: inline-block
        vertical-align: top
        width: 12px
        height: 12px
        margin-right: 4px
        background-size: 12px
        background-repeat: no-repeat
        &.decrease
          bgimage('./img/decrease_1')
        &.discount
          bgimage('./img/discount_1')
        &.guarantee
          bgimage('./img/guarantee_1')
        &.invoice
          bgimage('./img/invoice_1')
        &.special
          bgimage('./img/special_1')
      .text
        line-height: 12px
        font-size: 10px
    .support-count
      position: absolute
      right: 12px
      bottom: 18px
      padding: 0 8px
      height: 24px
      line-height: 24px
      text-align: center
      border-radius: 14px
      background-color: rgba(0, 0, 0, 0.2)
      .count
        vertical-align: top
        font-size: 10px
        margin-right: 2px
      .icon-keyboard_arrow_right
        line-height: 24px
        font-size: 10px
    .avatar
      border-radius: 4px
      img
        width: 64px
  .bulletin-wrapper
    position: relative
    display: flex
    height: 28px
    line-height: 28px
    padding: 0 22px 0 12px
    background-color: rgba(7, 17, 27, 0.2)
    .bulletin-icon
      display: inline-block
      vertical-align: top
      margin-top: 8px
      width: 22px
      height: 12px
      bgimage('./img/bulletin')
      background-size: 22px 12px
      background-repeat: no-repeat
    .bulletin-text
      flex: 1
      vertical-align: top
      margin: 0 4px
      font-size: 10px
      line-height: 28px
      color: #ffffff
      ellipsis()
    .icon-keyboard_arrow_right
      position: absolute
      font-size: 10px
      right: 12px
      top: 8px
  .background
    position: absolute
    top: 0
    left: 0
    width: 100%
    z-index: -1
    filter: blur(10px)
    img
      width: 100%
</style>